package reflect;

import java.lang.reflect.Field;
import java.lang.reflect.Method;

public class ReflectDemo8 {
    public static void main(String[] args) throws Exception{

        Class<?> cls = Class.forName("reflect.Teacher");
        Object obj = cls.newInstance();

        Field field = cls.getDeclaredField("name");
        field.setAccessible(true);
        field.set(obj, "张三");
        System.out.println(obj);
    }
}
